FREEFILE Function ---------------------------------------------------------------------------- Action Returns the next valid unused file number. Syntax FREEFILE Remarks Use FREEFILE when you need to supply a file number and you want to ensure that the file number is not already in use. See Also OPEN (File I-O) Example The following example uses FREEFILE to obtain the next available file number for opening a sequential file. OPEN, CLOSE, and KILL also are used. DIM Filenum AS INTEGER CLS INPUT "Enter filename. ", filename$ Filenum% = FREEFILE OPEN filename$ FOR OUTPUT AS Filenum% PRINT PRINT UCASE$(filename$); " opened for output as File #"; Filenum% ' Put something out to the file. PRINT #Filenum%, "The quick brown fox jumped over the lazy dog." ' Close the file just opened. CLOSE Filenum% Filenum% = FREEFILE OPEN filename$ FOR INPUT AS Filenum% PRINT . PRINT UCASE$(filename$); " has been reopened for input." LINE INPUT #Filenum%, L$ PRINT . PRINT "The contents of the file are."; L$ CLOSE Filenum% ' Remove the file from disk. KILL filename$